<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
export default {
  created() {
    // 当session中存在store，则将原来的store替换
    if (localStorage.getItem('store')) {
      const localStore = JSON.parse(localStorage.getItem('store'));
      for (let key in localStore) {
        this.$store.state[key] = localStore[key];
      }
    }
    window.addEventListener("beforeunload",()=>{
      localStorage.setItem('store',JSON.stringify(this.$store.state))
    })
  }
}
</script>

<style lang="scss">
  html, body {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    #app {
      width: 100%;
      height: 100%;
    }
    ::-webkit-scrollbar {
      width: 6px;
      height: 8px;
      background-color: rgb(241, 247, 252);
    }
    ::-webkit-scrollbar-track {
      -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
      border-radius: 10px;
      background-color: rgb(241, 247, 252);
    }
    //滚动条
    ::-webkit-scrollbar-thumb {
      border-radius: 10px;
      -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
      background-color: #aaaaaa;
    }
  }
</style>
